<?php
if(isset($arrSymbol) && !empty($arrSymbol)) {
	$jsSelectVal = "";
    $selectVal = "<option value='-1'>-</option>";
	foreach ($arrSymbol as $item) {
		$selectVal .= "<option value='{$item->getId()}'>" . html_escape($item->getUrlVal()) .'</option>';
	}
    for($i=0; $i<$max1; $i++) { ?>
    <p class="table-row" id="row<?php echo $i; ?>" >
		<select class="select" id="cmp<?php echo $i; ?>-0" name="cmp[<?php echo $i; ?>][0]"><?php echo $selectVal; ?></select>
		<select class="select" id="cmp<?php echo $i; ?>-1" name="cmp[<?php echo $i; ?>][1]"><?php echo $selectVal; ?></select>
	</p>
<?php
    if(!empty($arrSelect) && isset($arrSelect[$i])){
		$jsSelectVal .= "$('select#cmp$i-0').val(" . $arrSelect[$i][0] . ");\n";
		$jsSelectVal .= "$('select#cmp$i-1').val(" . $arrSelect[$i][1] . ");\n";
	}
 } ?>
<div class="hiddenPanel" style="display: none;">
<?php for($i=$max1; $i<$max2; $i++) { ?>
    <p class="table-row" id="row<?php echo $i; ?>" >
		<select class="select" id="cmp<?php echo $i; ?>-0" name="cmp[<?php echo $i; ?>][0]"><?php echo $selectVal; ?></select>
		<select class="select" id="cmp<?php echo $i; ?>-1" name="cmp[<?php echo $i; ?>][1]"><?php echo $selectVal; ?></select>
	</p>
<?php
	if(!empty($arrSelect) && isset($arrSelect[$i])){
		$jsSelectVal .= "$('select#cmp$i-0').val(" . $arrSelect[$i][0] . ");";
		$jsSelectVal .= "$('select#cmp$i-1').val(" . $arrSelect[$i][1] . ");";
	}
} ?>
</div>
<?php if(!empty($jsSelectVal)) { ?><script type="text/javascript">$(document).ready(function(){<?php echo $jsSelectVal; ?>});</script><?php } } ?>